<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>4.nextTick的使用</title>
		<script type="text/javascript" src="./vue.js"></script>
	</head>
	<body>

		<div id="demo">
			<h1 id="h1">{{a}}</h1>
			<button @click="add">点我a+1</button>
		</div>

		<script type="text/javascript" >
			new Vue({
				el:'#demo',
				data:{
					a:0
				},
				methods: {
					add(){
						this.a++
						// console.log(this.a,document.getElementById('h1').innerText)
						this.$nextTick(()=>{
							console.log(this.a,document.getElementById('h1').innerText)
						})
					}
				},
			})
		</script>
	</body>
</html>